//
// Created by madison on 2022/1/27.
//

#include <iostream>

using namespace std;

int main() {
    int a = 5, b = 10, temp;

    cout << "交换之前：" << endl;
    cout << "a = " << a << ", b = " << b << endl;

    temp = a;
    a = b;
    b = temp;

    cout << "\n交换之后：" << endl;
    cout << "a = " << a << ", b = " << b << endl;

    void fun();
    fun();

    return 0;
}

void fun() {
    int a = 5, b = 10;

    cout << "交换之前：" << endl;
    cout << "a = " << a << ", b = " << b << endl;

    a = a + b;
    b = a - b;
    a = a - b;

    cout << "\n交换之后：" << endl;
    cout << "a = " << a << ", b = " << b << endl;
}